/*
 * @Author: shengduiliang 1107722390@qq.com
 * @Date: 2024-05-04 16:49:56
 * @LastEditors: shengduiliang 1107722390@qq.com
 * @LastEditTime: 2024-05-05 16:54:31
 * @FilePath: /treasure/src/ui-components/text-input/index.tsx
 * @Description: 输入框组件
 */
import { Textarea, TextareaProps, View } from "@tarojs/components"
import { memo } from "react"
import './index.scss'

interface TextInputProps extends TextareaProps {
  label: string
  onChange?: (value: string) => void
}

const TextArea = (props: TextInputProps) => {
  return (
    <View className='input-textarea pv-normal-mh-normal'>
      <View className='label text-primary-bold'>{props.label}</View>
      <Textarea
        className='textarea text-primary mt-medium w-100'
        placeholderClass='text-secondary'
        onInput={(e) => { props.onChange && props.onChange(e.detail.value) }}
        disableDefaultPadding
        {...props}
      />
    </View>
  )
}

export default memo(TextArea)